//
//  UIView+YCTools.h
//  Pods
//
//  Created by Apple on 2022/11/2.
//

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

typedef NS_ENUM(NSUInteger, YCRadiusShadowPathType) {
    YCRadiusShadowPathTypeLeft,
    YCRadiusShadowPathTypeRight,
    YCRadiusShadowPathTypeTop,
    YCRadiusShadowPathTypeBottom,
    YCRadiusShadowPathTypeNoTop,
    YCRadiusShadowPathTypeAll,
};


@interface UIView (YCTools)

@property (nonatomic, assign) CGFloat cornerRadius;

/// 添加圆角
/// - Parameters:
///   - radius: 圆角大小
///   - corner: 圆角位置（上下左右）
- (void)radiusWithRadius:(CGFloat)radius corner:(UIRectCorner)corner;

/// 设置圆角
/// @param radius 圆角尺寸
- (void)radiusAllCornerWithRadius:(CGFloat)radius;

/// 添加边框
/// - Parameters:
///   - borderColor: 边框颜色
///   - borderWidth: 边框大小
- (void)setBorderWithColor:(UIColor *)borderColor borderWidth:(CGFloat)borderWidth;

/// 设置阴影
/// - Parameters:
///   - shadowColor: 阴影颜色
///   - shadowOffset: 范围
///   - shadowRadius: 半径
- (void)setShadowWithColor:(UIColor *)shadowColor shadowOffset:(CGSize)shadowOffset shadowRadius:(CGFloat)shadowRadius;

/// 设置阴影
/// - Parameters:
///   - shadowColor: 阴影颜色
///   - shadowOffset: 范围
///   - shadowOpacity: 透明度
///   - shadowRadius: 半径
- (void)setShadowWithColor:(UIColor *)shadowColor shadowOffset:(CGSize)shadowOffset shadowOpacity:(CGFloat)shadowOpacity shadowRadius:(CGFloat)shadowRadius;

/// 设置圆角阴影
/// - Parameters:
///   - shadowColor: 阴影颜色
///   - shadowOffset: 范围
///   - shadowOpacity: 透明度
///   - shadowRadius: 半径
///   - shadowPathSide: 方向
///   - shadowPathWidth: 宽度
///   - radiusLocation: 圆角半径
- (void)setRadiusShadowPath:(UIColor *)shadowColor shadowOpacity:(CGFloat)shadowOpacity shadowRadius:(CGFloat)shadowRadius shadowSide:(YCRadiusShadowPathType)shadowPathSide shadowPathWidth:(CGFloat)shadowPathWidth radiusLocation:(NSInteger)type;

/// 添加线
- (void)setLineWithFrame:(CGRect)frame color:(UIColor *)color;

/// 判断是否与另一个视图重合
/// - Parameter view: 另一个视图
- (BOOL)intersectsWithView:(UIView *)view;

/// 查找作特定类的第一个子视图
/// - Parameter cls: 特定类
- (UIView *)descendantOrSelfWithClass:(Class)cls;

/// 查找作特定类的第一个父视图
/// - Parameter cls: 特定类
- (UIView *)ancestorOrSelfWithClass:(Class)cls;

/// 移除所有子视图
- (void)removeAllSubviews;

/// 与另一个视图的位置
/// - Parameter otherView: 另一个视图
- (CGPoint)offsetFromView:(UIView *)otherView;

/// 在父视图的位置
/// - Parameter superView: 父视图
- (CGRect)convertRectToView:(UIView *)superView;

/// 用xib创建
+ (instancetype)viewFromXib;

/// 初始化View
/// @param frame frame description
/// @param backgroundColor backgroundColor description
+ (instancetype)viewWithFrame:(CGRect)frame backgroundColor:(nullable UIColor *)backgroundColor;

/// 初始化颜色
/// @param backgroundColor backgroundColor description
+ (instancetype)viewWithBackgroundColor:(nullable UIColor *)backgroundColor;

/// 添加线
/// @param frame 位置
- (void)addLineViewFrame:(CGRect)frame;

/// 添加线
/// @param frame 位置
- (void)addLineColorF3F3F3:(CGRect)frame;

/// 添加线
/// @param frame 位置
- (void)addLineColorEEEEEE:(CGRect)frame;

@end

NS_ASSUME_NONNULL_END
